Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add os.Rename wrapper for Plan 9 #87

Merged
merged 1 commit into from
Jul 29, 2020
Merged

Add os.Rename wrapper for Plan 9 #87

merged 1 commit into from
Jul 29, 2020

Conversation

fhs
Copy link
Contributor

@fhs fhs commented Jul 27, 2020

os.Rename documentation says: "OS-specific restrictions may apply when
oldpath and newpath are in different directories." On Unix, this means
we can't rename across devices. On Plan 9 however, the functionality is
even more limited: cross-directory renames are not allowed at all.

Add a wrapper around os.Rename for Plan 9, which will copy the file if
we're renaming across directory. All tests seems to pass.

(Aside: I also had to write this wrapper to get go-git working on Plan 9:
https://github.com/go-git/go-billy/blob/v5.0.0/osfs/os_plan9.go#L27
but I notice few issues with that one.)

Fixes #86

@welcome
Copy link

welcome bot commented Jul 27, 2020

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

os.Rename documentation says: "OS-specific restrictions may apply when
oldpath and newpath are in different directories." On Unix, this means
we can't rename across devices. On Plan 9 however, the functionality is
even more limited: cross-directory renames are not allowed at all.

Add a wrapper around os.Rename for Plan 9, which will copy the file if
we're renaming across directory. All tests seems to pass.

(Aside: I also had to write this wrapper to get go-git working on Plan 9:
https://github.com/go-git/go-billy/blob/v5.0.0/osfs/os_plan9.go#L27
but I notice few issues with that one.)

Fixes ipfs#86
@willscott
Copy link
Contributor

I didn't look particularly carefully at this one yet, but the logic seems fine.
I am wondering if maybe this is impetus for getting tests to run in CI for this repo, so that we don't accidentally break plan9.

I'm not fully sure if any of the CIs IPFS has been using have support for plan9 runners. that's probably an assumption to check first before seeing if that's worth doing.

@fhs
Copy link
Contributor Author

fhs commented Jul 27, 2020

I don't think any of the CIs IPFS uses supports Plan 9. I would be happy with just checking if cross compiling to GOOS=plan9 works. We can do that in the main go-ipfs repo once few more fixes (coming up) lands.

@willscott
Copy link
Contributor

to confirm though, cross compiling GOOS=plan9 would not catch this issue, which would be caught by the test suite, but not by compilation alone.

@fhs
Copy link
Contributor Author

fhs commented Jul 28, 2020

to confirm though, cross compiling GOOS=plan9 would not catch this issue, which would be caught by the test suite, but not by compilation alone.

Correct. I don't see any easy way of running the tests. The only public Plan 9 CI I know of is the one from sr.ht but I never got it to work correctly. The Go project has a custom solution: https://farmer.golang.org/builders

To clarify, I originally found out about the os.Rename issue when ipfs init was failing. When things are as broken as it is now on Plan 9, we'll find the issues without running the tests. That is of course not a good reason to not set up CI if we can.

@willscott
Copy link
Contributor

agreed - i also don't see a great way to automate keeping this from breaking in the future. Your plan seems reasonable for now.

@willscott willscott merged commit d5fa746 into ipfs:master Jul 29, 2020
@aschmahmann aschmahmann mentioned this pull request Sep 22, 2020
72 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests are failing on Plan 9 because os.Rename doesn't rename across directory
2 participants